package com.ych.controller;

import com.ych.beans.Message;
import com.ych.beans.SensorModel;
import com.ych.service.SensorModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/model/sensor")
public class SensorModelController {
    @Autowired
    SensorModelService service;

    @PostMapping
    public Message addSensorModel(@RequestBody SensorModel p){
        return service.addSensorModel(p);
    }

    @PutMapping
    public Message updateSensorModel(@RequestBody SensorModel p){
        return service.updateSensorModel(p);
    }

    @DeleteMapping("/{id}")
    public Message deleteSensorModel(@PathVariable Integer id){
        return service.deleteSensorModel(id);
    }
    @GetMapping
    public Message selectSensorModel(@RequestParam Integer pageNo,@RequestParam(required = false) String key){
        return service.selectSensorModel(pageNo,key);
    }
}
